using System.Data.Entity.ModelConfiguration;

namespace OBUCare.Core.Models.Mapping
{
    public class View_PartsStockMap : EntityTypeConfiguration<View_PartsStock>
    {
        public View_PartsStockMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Owner, t.PARTS_ID, t.SUPPLIER_ID, t.PARTS_SPEC_ID, t.Status });

            // Properties
            this.Property(t => t.Owner)
                .IsRequired()
                .HasMaxLength(16);

            this.Property(t => t.PARTS_ID);
            

            this.Property(t => t.PARTS_NAME)
                .HasMaxLength(50);

            this.Property(t => t.SUPPLIER_ID);

            this.Property(t => t.SUPPLIER_NAME)
                .HasMaxLength(200);

            this.Property(t => t.PARTS_SPEC_ID);

            

            // Table & Column Mappings
            this.ToTable("View_PartsStock");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Owner).HasColumnName("Owner");
            this.Property(t => t.PARTS_ID).HasColumnName("PARTS_ID");
            this.Property(t => t.PARTS_NAME).HasColumnName("PARTS_NAME");
            this.Property(t => t.SUPPLIER_ID).HasColumnName("SUPPLIER_ID");
            this.Property(t => t.SUPPLIER_NAME).HasColumnName("SUPPLIER_NAME");
            this.Property(t => t.SPEC_NAME).HasColumnName("SPEC_NAME");
            this.Property(t => t.PARTS_SPEC_ID).HasColumnName("PARTS_SPEC_ID");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Amount).HasColumnName("Amount");
        }
    }
}
